<%@page import="salary.SalaryVo"%>
<%@page import="java.util.ArrayList"%>
<%@page import="salary.SalaryMyba"%>
<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>사원관리 리스트</title>

<style type="text/css">
#a {
	z-index: 10;
	width: 1000px;
	margin:auto;
}

#b {
    z-index: 10;
	width: 1000px;
	height: 90px;
	border: 1px solid #cccccc;
	position: relative;
	background-color: #F2F2F2;
	background-repeat: no-repeat;
	background-size: 100% 100%;
	border-radius: 5px;
}

#b-1 {
	width: 1000px;
	margin-top: 5px;
	border-radius: 5px;
	
}

#c,#d {
	width: 1000px;
	height: 0px;
	
	
}
/* #c, #d가 가지는 칼럼수는 10가지 width를 전체 1000을 주어졌으니 10씩 차지함! */
#c div { 
	width: 68px;
	padding: 10px 0px;
	float: left;
	text-align: center;
	font-size: 13px;
	font-weight: bold;
	background-color: #F2F2F2;
	border-bottom: 1px solid;
	border-right: 1px solid;
	border-top: 1px solid;
}

#d div {
	width: 68px;
	padding: 10px 0px;
	float: left;
	text-align: center;
	font-size: 13px;
	background-color: #ffffff;
	border-bottom: 1px solid;
	border-right: 1px solid;	
}
</style>
<script>
var cnt = 0;
function getId(id) { 
	return document.getElementById(id);
	}
	
function goPage(page) {
	//alert(page);
	var ff=document.find_form;
	ff.nowPage.value=page;
	//alert(page);
	ff.action='index.jsp?inc_content=./salary/salary_list.jsp&nowPage='+page;
	ff.submit();
}

function init() {
	getId('btnFind').onclick = findFunc;
	getId('find').onkeyup = function(ev) {
		if (ev.keyCode == 13)
			findFunc();
	}
}

function findFunc() {
	find = getId('find').value;
	location.href = 'index.jsp?inc_content=./salary/salary_list.jsp&find='+ find;
	
}

</script>
</head>
<body>
	<jsp:useBean id="vo" class="salary.SalaryVo" />
	<jsp:setProperty property="*" name="vo" />
<%
SalaryMyba salary = new SalaryMyba();
salary.setSalaryvo(vo);
ArrayList<SalaryVo> data = salary.list();
%>

	<div style="height:20px"></div>
	<div id="a">

		<div id="b">  <!-- content top -->
			<h3>&nbsp;&nbsp;&nbsp;사원목록 리스트</h3>
			<input type='button' value='사원신규등록'
				style='margin-top: 0px; margin-right: 10px; float: right; z-index: 10;'
				onclick="location.href='index.jsp?inc_content=./salary/salary_registration.jsp'">
				
		</div>

		 <form name='find_form' method='post' style='margin-top: 10px;'> 
			 <!-- &nbsp;&nbsp;&nbsp;<select title="검색구분선택" id="">
				 <option class="pr20px" value="ra">사원명</option>
				<option value="rb">사원번호</option> </select>  -->
				<input type='search' id='find' name='find' value='<%=vo.getSA_nm() %>'placeholder="사원번호 및 이름입력">
				<input type='button' id='btnFind' value="검색">
				<input type="hidden" name='nowPage' id='nowPage' value='<%=salary.getNowPage() %>'>
		 
		<p/>

		<div id="b-1">  <!-- content midum -->  
			<div id="c">  <!-- 메뉴바 -->
				<div style="border-left: 1px solid; width: 74px;">사원번호</div>
				<div>사원명</div>
				<div style="width: 62px">나이</div>
				<div style="width: 115px">연락처</div>
				<div style="width: 330px;">주소</div>
				<div>부서</div>
				<div>직급</div>
				<div>상태코드</div>
				<div>성별</div>
				<div>연봉</div>
			</div>
			
			
			

			<div id="d"> <!-- 내용 -->
			
		
			
			
			<%
				for(int i=0; i<data.size(); i++){
					SalaryVo sv=data.get(i);
					
				%>
				<div style="border-left: 1px solid; width: 74px;">
					<a href="index.jsp?inc_content=./salary/salary_view.jsp&SA_no=<%=sv.getSA_no() %>"
						style="text-decoration: none;"><%=sv.getSA_no() %></a>
				</div>
				<div><%=sv.getSA_nm() %></div>
				<div style="width: 62px"><%=sv.getSA_age() %>세</div> 
				<div style="width: 115px"><%=sv.getSA_ph() %></div>
				<div style="width: 330px; white-space: nowrap; overflow: hidden; 
				            text-overflow: ellipsis; vertical-align: middle;"><%=sv.getSA_address() %></div>
				            
			<%
					String dpm="";
					if(sv.getSA_dpm().equals("01"))
						dpm="인사팀";
					else if(sv.getSA_dpm().equals("02"))
						dpm="개발팀";
					else if(sv.getSA_dpm().equals("03"))
						dpm="총무팀";
					else
						dpm="홍부팀";
				%>
				<div><%=dpm %></div>
			
			
			<%
					String gd="";
					if(sv.getSA_gd().equals("01"))
						gd="신입";
					else if(sv.getSA_gd().equals("02"))
						gd="대리";
					else if(sv.getSA_gd().equals("03"))
						gd="과장";
					else if(sv.getSA_gd().equals("04"))
						gd="부장";
					else if(sv.getSA_gd().equals("05"))
						gd="팀장";
					else
						gd="이사";
				%>
				<div><%=gd %></div>
				
				
				
				<%
					String st="";
					if(sv.getSA_st().equals("01"))
						st="재직";
					else if(sv.getSA_st().equals("02"))
						st="해임";
					else if(sv.getSA_st().equals("03"))
						st="휴직";
					else if(sv.getSA_st().equals("04"))
						st="퇴임";
					else
						st="퇴사";
				%>
				<div><%=st %></div>
				
				<div><%=sv.getSA_sx() %></div>
			    <div><%=sv.getSA_sal() %>만원</div> 
				
				
				<%} %>
				
				
				
			</div>
		</div>
		<div id="SBottom" >
			<div style="text-align: center; ">
				<!-- 페이지 분리 영역 -->
				<%
					if(salary.getNowBlock()>1){
				%>
				<input type="button" value="맨첨" onclick="goPage(1)"> <input
					type="button" value="이전"
					onclick="goPage(<%=salary.getNowPage()-1%>)">
				<%
					}
				%>
				<%
					for(int s = salary.getStartPage(); s <= salary.getEndPage();s++){
				%>
				<input type="button" value="<%=s%>" onclick="goPage(<%=s%>)">
				<%
					}
				%>
				<input type="button" value="다음" onclick="goPage('<%=salary.getEndPage()+1%>')"> 
				<input type="button" value="맨끝" onclick="goPage('<%=salary.getTotPage()%>')">
			</div>
		</div>
		</form>
	</div>
	<div style="height:10px"></div>
<script>init();</script>
</body>
</html>
